/**
 * Created by IntelliJ IDEA.
 * User: Tomek
 * Date: 09.02.13
 * Time: 14:22
 * To change this template use File | Settings | File Templates.
 */
package AS3.calculator {
import AS3.CalculationResult;
import AS3.Country;
import AS3.constants.Coefficients;

public class FossilsConsumptionCalculator {
    public function FossilsConsumptionCalculator() {
    }


    public function calculate(calcResult:CalculationResult,country:Country):FossilsConsumption {
        var result:FossilsConsumption = new FossilsConsumption();
        var totalElectricityEnergy:Number = calcResult.electricityEnergy + 0.15 * calcResult.biomassEnergy/3;



        result.coal = (calcResult.coalEnergy + totalElectricityEnergy * country.coalEnergyPercentage) *
                       Coefficients.COAL_KG_PER_GJ_HEAT;

        result.oil =  (calcResult.oilEnergy + 0.1 * calcResult.biomassEnergy + totalElectricityEnergy * country.oilEnergyPercentage) *
                       Coefficients.OIL_KG_PER_GJ_HEAT;

        result.gas = (calcResult.gasEnergy + totalElectricityEnergy * country.gasEnergyPercentage) *
                      Coefficients.GAS_KG_PER_GJ_HEAT;


        return result;
    }
}
}
